package com.example.service.impl;

import com.example.dao.UserDao;
import com.example.entity.User;
import com.example.service.UserService;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Author:sun
 * Date:2021/12/19
 * Note:*
 **/
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserDao userDao;

    @Resource
    private StringRedisTemplate stringRedisTemplate;

    //用户注册，如果成功则返回User对象，带有id，注册失败返回null。
    @Override
    public User userRegister(User user) {
        int i = userDao.insertUser(user);
        if (i>0){
            return user;
        }else{
            return null;
        }
    }
}
